const user=[
    {id:1,name:'111',password:'111',type:'管理员'},
    {id:2,name:'222',password:'222',type:'用户'},
]
const userInform=[
    {id:1,content:[
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'苹果公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
    ]},
    {id:2,content:[
        {name:'华为公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'华为公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'华为公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
        {name:'华为公司',start:'1997-03-10',rule:'企业会计准则',operate:'做账'},
    ]},
]
export default {
    'POST /api/getuser': (req:any,res:any)=>{
        let n=0
        user.forEach((v)=>{
            if(v.name==req.body.username && v.password==req.body.password && v.type==req.body.remember){
                res.json({code:200,msg:'查询成功',data:v.id})
                n=1
            }
        })
        if(n==0){
            res.json({code:500,msg:'查无此人'})    
        }
    },
    'POST /api/getUserLedger':(req:any,res:any)=>{
        if(req.body.id){
            const data:any=userInform.map((v)=>{
                if(v.id==req.body.id){
                    return v
                }
            })
            res.json({code:200,msg:'查询成功',data:data[0]})
        }else{
            res.json({code:500,msg:'暂无数据'})
        }
    }
}